import request from "@/utils/request";

// 智能问答-大模型-自动回复
export function aiChatText(url, query) {
  return request({
    url: url,
    method: "post",
    data: query,
  });
}

// 智能问答-大模型-文字转语音
export function aiTextToAudio(url, text) {
  return request({
    url: url,
    method: "post",
    body: text,
  });
}

// 查询智能问答列表
export function listAiChat(query) {
  return request({
    url: "/aiChat/aiChat/list",
    method: "get",
    params: query,
  });
}

// 查询智能问答详细
export function getAiChat(id) {
  return request({
    url: "/aiChat/aiChat/" + id,
    method: "get",
  });
}

// 新增智能问答
export function addAiChat(data) {
  return request({
    url: "/aiChat/aiChat",
    method: "post",
    data: data,
  });
}

// 修改智能问答
export function updateAiChat(data) {
  return request({
    url: "/aiChat/aiChat",
    method: "put",
    data: data,
  });
}

// 删除智能问答
export function delAiChat(id) {
  return request({
    url: "/aiChat/aiChat/" + id,
    method: "delete",
  });
}

// 查询历问答标题
export function getAiChatTitle(userId) {
  return request({
    url: "/aiChat/aiChat/history/" + userId,
    method: "get",
  });
}

// 查询对应标题问答记录
export function postTitleByChat(data) {
  return request({
    url: "/aiChat/aiChat/questionAndAnswer",
    method: "post",
    data: data,
  });
}

// 查询对应标题问答记录
export function addTitleByChat(data) {
  return request({
    url: "/aiChat/aiChat/",
    method: "post",
    data: data,
  });
}

export function getlastTitleId(userId) {
  return request({
    url: "/aiChat/aiChat/lastTitleId/" + userId,
    method: "get",
  });
}
